<%

String host      = (String)request.getSession().getAttribute("Con_host");
String database  = (String)request.getSession().getAttribute("Con_database");
String usuariobd = (String)request.getSession().getAttribute("Con_usuario");
String senhabd   = (String)request.getSession().getAttribute("Con_senha");
Connect.updateConnection(host,database,usuariobd,senhabd);

	String esquema = (String) session.getAttribute("esquema");
	if (esquema == null) {
		esquema = "branco";
	}

	String empresa = (String) session.getAttribute("empresa");
	if (empresa == null) {
		empresa = "000";
	}
	
	String esquemacss = (String) session.getAttribute("esquemacss");
	if (esquemacss == null) {
		esquemacss = "branco_S";
	}
    
	String modulos = (String) session.getAttribute("login_modulos");
    
    if (modulos == null) {
    	modulos = "";
	}
    
    String usuoperad = (String) session.getAttribute("usuoperad");
	String versao = (String) session.getAttribute("versao");
	
	if (usuoperad == null) {
		usuoperad = " ";
	}
	
	DBuserVO userVO = new DBuserVO(request);
	if(userVO.getHost()!=null && !userVO.getHost().isEmpty()){
		
	}else{
		response.sendRedirect("index.jsp");
	}
	
	String nome = request.getContextPath();
	nome = nome.substring(1); //Tira a barra
	
	String acessoremoto = (String) session.getAttribute("acessoremoto");
	if(acessoremoto!=null){
		if(acessoremoto.equals("true")){
			acessoremoto = "''";
		}else{
			acessoremoto = "none";
		}
	}
%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@page import="conexao.Connect"%>
<%@page import="util.FData"%>
<%@page import="java.util.ArrayList"%>

<%@page import="datamodule.DBuserVO"%><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title><%=nome.toUpperCase()%> Desktop</title>

<%--<link REL="SHORTCUT ICON" HREF="images/esquema/<%=esquema%>/favicon.ico" type="image/x-icon" /> --%>
<%--<link REL="ICON" HREF="images/esquema/<%=esquema%>/favicon.ico"	type="image/x-icon" /> --%>

<link rel="stylesheet" type="text/css"	href="lib/ext/resources/css/ext-all.css" />
<link rel="stylesheet" type="text/css"	href="temas/xtheme-vistaglass/css/xtheme-vistaglass.css" />
<link rel="stylesheet" type="text/css" href="css/desktop.css" />
<link rel="stylesheet" type="text/css" href="css/preferencias.css" />
<!-- GC -->
<!-- LIBS -->
<script type="text/javascript" src="lib/ext/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="lib/ext/ext-all.js"></script>

<script type="text/javascript" src="js/ajaxBox.js"></script>

<!-- DESKTOP -->
<script type="text/javascript" src="js/StartMenu.js"></script>
<script type="text/javascript" src="js/TaskBar.js"></script>
<script type="text/javascript" src="js/Shortcut.js"></script>
<script type="text/javascript" src="js/Desktop.js"></script>
<script type="text/javascript" src="js/App.js"></script>
<script type="text/javascript" src="js/Module.js"></script>

<script type="text/javascript" src="js/DesktopConfig.js"></script>

<script type="text/javascript" src="js/Preferencias.js"></script>
<script type="text/javascript" src="js/Chat.js"></script>

<script type="text/javascript">

	function atalho(e){
		if(e.ctrlKey){
			if(e.keyCode==77){
				PiDesktop.desktop.taskbar.startButton.showMenu();
			}
		}
	}

</script>
</head>

<body style="cursor: default;" onkeydown="atalho(event);" onload="">

<script type="text/javascript">
	////Iniciar o script para manter a sessao ativa
	/// o Servlet Log envia um script em seu retorno
	log('start','start','sessao=start');
	var it;
	function startLog(cont){
		log('sessao',cont,'sessao=manter'); 
		it = window.setInterval(function() { log('sessao',cont,'sessao=manter'); return false; },1000 *60* 3); //3 min.
	}
</script>

<form name="formdesktop">

<input type="hidden" id="vesquema" value="<%=esquema%>"> 
<input type="hidden" id="vesquemacss" value="<%=esquemacss%>"> 
<input type="hidden" id="login_modulos"	value="<%=modulos%>"> 
</form>

<div id="x-desktop" style="cursor: default;">

<dl id="x-shortcuts">
</dl>
</div>

<div id="ux-taskbar">
<div id="ux-taskbar-start"></div>
<div id="ux-taskbar-panel-wrap">
<div id="ux-quickstart-panel"></div>
<div id="ux-taskbuttons-panel"></div>

</div>
<div class="x-clear"></div>
</div>


</body>
</html>
